package com.api.day01stringdemo1;

public class MatchesDemo {
    public static void main(String[] args) {
        /*
        邮箱正则表达式
        */

        String  email = "zero 123@qq.com";
        String regex = "[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)";
        boolean flag = email.matches(regex);
        if (flag){
            System.out.println("匹配成功，格式正确" );
        }else {
            System.out.println("匹配失败，格式错误");
        }

    }

}
